<template>
  <div>
    <el-button size="mini" @click="toadd()">添加</el-button>
    <el-table
      ref="multipleTable"
      :data="tableData"
      tooltip-effect="dark"
      style="width: 100%"
      @selection-change="handleSelectionChange">
      <el-table-column
        type="selection"
        width="55">
      </el-table-column>
      <!--    <el-table-column-->
      <!--      label="日期"-->
      <!--      width="120">-->
      <!--      <template slot-scope="scope">{{ scope.row.date }}</template>-->
      <!--    </el-table-column>-->

      <el-table-column prop="name" label="仓库名" show-overflow-tooltip></el-table-column>
      <el-table-column prop="wareCode" label="仓库编号" show-overflow-tooltip></el-table-column>
      <el-table-column prop="adminName" label="仓库管理员" show-overflow-tooltip></el-table-column>
      <el-table-column prop="address" label="仓库地址" show-overflow-tooltip></el-table-column>
      <el-table-column prop="areacode" label="区域编码" show-overflow-tooltip></el-table-column>
      <el-table-column prop="amountRecords" label="金额记录" show-overflow-tooltip></el-table-column>
      <el-table-column prop="status" label="状态" show-overflow-tooltip>
        <template slot-scope="scope">
          <span v-if="scope.row.status === 1">有效</span>
          <span v-else-if="scope.row.status === 2">无效</span>
        </template>

      </el-table-column>

      <el-table-column label="操作">
        <template slot-scope="scope">
          <el-button
            size="mini"
            @click="handleEdit(scope.$index, scope.row)">编辑</el-button>
          <el-button
            size="mini"
            type="danger"
            @click="handleDelete(scope.$index, scope.row)">删除</el-button>
        </template>
      </el-table-column>
    </el-table>

  </div>

</template>
<script>
import { getList } from '../../../api/wms/info'

export default {
  name: 'index',
  data() {
    return {
      tableData: [],
      multipleSelection: []
    }
  },
  created() {
    this.getTable();
  },
  methods: {
    getTable(){
      getList().then((res)=>{
        this.tableData = res.data;
      })
    },
    handleSelectionChange(val) {
      this.multipleSelection = val;
    },
    handleEdit(index, row) {
      console.log(index, row);
    },
    handleDelete(index, row) {
      console.log(index, row);
    },
    toadd(){
      this.$router.push({path:'/wms/addinfo'});
    },
    handleSizeChange(val) {
      this.warehouseTypeDTO.pageSize=val;
      this.getTable();
    },
    handleCurrentChange(val) {
      this.warehouseTypeDTO.pageNum=val;
      this.getTable();
    }
  }

}
</script>

<style scoped>

</style>
